home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Camelot
/
Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].zip
/
Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].adf
/
XLisp-Stat
/
Book
/
interpolation1.lsp
< prev
next >
Wrap
Lisp/Scheme
|
1990-10-11
|
812b
|
30 lines
; book pp.300-301
(require "data/stackloss")
(defun standardize (x)
(let ((x-bar (mean x))
(s (standard-deviation x)))
(/ (- x x-bar) s)))
(setf std-air (standardize air))
(setf std-temp (standardize temp))
(setf std-conc (standardize conc))
(setf std-loss (standardize loss))
(setf w (plot-points std-air std-temp))
(send w :range '(0 1) -3 3)
(setf indices (iseq (length std-air)))
(defun interpolate (p)
(let* ((alpha (* (/ pi 2) p))
(s (sin alpha))
(c (cos alpha))
(x (+ (* c std-air) (* s std-temp)))
(y (+ (* c std-conc) (* s std-loss))))
(send w :point-coordinate 0 indices x)
(send w :point-coordinate 1 indices y)
(send w :redraw-content)))
(slider (interval-slider-dialog '(0 1) :action #'interpolate))
(send w :add-subordinate slider)